package com.ssm.controller;

import com.ssm.bean.Department;
import com.ssm.bean.Employee;
import com.ssm.bean.Message;
import com.ssm.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 处理和部门有关的请求
 */
@Controller
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;



    /**
     * 返回所有的部门信息（给予新员工选择）
     */
    @RequestMapping("/depts")
    @ResponseBody
    public Message getDepts(){
        List<Department> list=departmentService.getDepts();

        return Message.success().add("depts",list);
    }

}
